package com.tidemark.ui.swing;

import java.awt.BorderLayout;

import javax.swing.JPanel;
import javax.swing.JScrollPane;
import javax.swing.JTable;

public class ResultPane extends JPanel {
	MainFrame mainFrame;
	
	SwingDataModel dataModel;
	JTable resultTable;
	
	public ResultPane(MainFrame parent) {
		mainFrame = parent;
		
		initUI();
	}
	
	private void initUI() {
		dataModel = new SwingDataModel();
		resultTable = new JTable(dataModel);
		
		setLayout(new BorderLayout());
		JScrollPane scrollPane = new JScrollPane(resultTable);
		add(scrollPane, BorderLayout.CENTER);
	}
	
	public void cleanGUI(){
		dataModel.removeAll();//clean previous data
	}
	
	public void refreshResult() {
		//new com.ifeng.stock.AbsoluteReader(dataModel).propose(); //AbsoluteReader is old algorithm
		//new com.tidemark.dingniu8.Reader(dataModel).propose();  //dingniu8 website has changed
		new com.ifeng.stock.RelativeReader(dataModel).propose();
	}
}
